package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.User;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface UserMapper {

    /**
     * 根据openId查找
     * @param openId
     */
    @Select("select * from user where openid = #{openId}")
    User getUserByOpenId(String openId);

    /**
     * 添加微信小程序用户
     * @param user
     */
    void insert(User user);

    /**
     * 根据userId查找用户信息
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    /**
     * 得到用户数量
     * @param beginTime
     * @param endTime
     * @return
     */
    Integer getUserNum(LocalDateTime beginTime, LocalDateTime endTime);

}
